
#ifndef LOD_CVERTEX_H
#define LOD_CVERTEX_H

#include "vertex.h"

//! Coloured vertex
//
/*! Coloured vertices are used in case shading of some faces
 * is based on colours of their vertices instead of faces' materials.
 *
 * \param co_type A type used to store vertex coordinates.
 * \param comp_type A type used to represent components of the colour. */
template<class co_type, class comp_type>
class cvertex : public vertex<co_type>
{
    public:
    //! Colour of the vertex
    comp_type col[4];

    /*!
     * \param c Coordinates of this vertex
     * \param n Normal vector of this vertex
     * \param colour Colour of this vertex */
    cvertex(const co_type* c, const co_type* n, const comp_type* colour)
     : vertex<co_type>(c, n)
    {
        col[0] = colour[0];
        col[1] = colour[1];
        col[2] = colour[2];
        col[3] = colour[3];
    }

    cvertex()
    {
    }

    /*! 
     * \param cv A coloured vertex to compare this one with.*/
    bool operator== (const cvertex & cv) const
    {
        return ( ((vertex<co_type>*)this)->operator==(cv) &&
                 col[0] == cv.col[0] &&
                 col[1] == cv.col[1] &&
                 col[2] == cv.col[2] &&
                 col[3] == cv.col[3] );
    }
};

#endif
